//
//  TZYDebrisCollectionViewCell.m
//  Moment
//
//  Created by dllo on 15/12/26.
//  Copyright © 2015年 片刻. All rights reserved.
//

#import "TZYDebrisCollectionViewCell.h"

@interface TZYDebrisCollectionViewCell ()

@property (nonatomic, retain)UILabel *nameLabel;
@property (nonatomic, retain)UIImageView *headImageView;
@property (nonatomic, retain)UILabel *countLabel;

@end


@implementation TZYDebrisCollectionViewCell



-(instancetype)initWithFrame:(CGRect)frame{
    self = [super initWithFrame:frame];
    if (self) {
        [self createSubViews];
    }
    return self;
}

- (void)createSubViews{
    
    self.headImageView = [[UIImageView alloc] initWithFrame:self.contentView.bounds];
    self.headImageView.backgroundColor = [UIColor colorWithRed:0.31 green:0.34 blue:0.38 alpha:1];
    [self.contentView addSubview:self.headImageView];
#pragma mark- 图片自适应
    self.headImageView.contentMode = UIViewContentModeScaleAspectFill;
    self.headImageView.clipsToBounds = YES;
    
    
    UIImageView *imageView = [[UIImageView alloc] initWithFrame:self.contentView.bounds];
    imageView.backgroundColor = [UIColor blackColor];
    imageView.alpha = 0.3;
    [self.contentView addSubview:imageView];
    
    
    self.nameLabel = [[UILabel alloc] initWithFrame:CGRectMake(0, self.contentView.frame.size.height * 0.4, self.contentView.frame.size.width, self.contentView.frame.size.height * 0.15)];
    self.nameLabel.textAlignment = NSTextAlignmentCenter;
    self.nameLabel.font = [UIFont systemFontOfSize:[TZYFontSize getFontSizeForMiddle]];
    self.nameLabel.textColor = [UIColor colorWithRed:0.810 green:0.877 blue:0.920 alpha:1.000];
    //self.nameLabel.backgroundColor = [UIColor orangeColor];
    [self.contentView addSubview:self.nameLabel];
    
    
    self.countLabel = [[UILabel alloc] initWithFrame:CGRectMake(0, self.nameLabel.frame.origin.y + self.nameLabel.size.height + self.contentView.frame.size.height * 0.025, self.contentView.frame.size.width, self.contentView.frame.size.height * 0.1)];
    self.countLabel.font = [UIFont systemFontOfSize:[TZYFontSize getFontSizeForSmall]];
    self.countLabel.textAlignment = NSTextAlignmentCenter;
    self.countLabel.textColor = [UIColor colorWithRed:0.810 green:0.877 blue:0.920 alpha:1.000];
    //self.countLabel.backgroundColor = [UIColor purpleColor];
    [self.contentView addSubview:self.countLabel];
    
    
    
}



- (void)setDebrisList:(TZYDebrisList *)debrisList
{
    if (_debrisList != debrisList) {
        _debrisList = debrisList;
    }
    [self.headImageView sd_setImageWithURL:[NSURL URLWithString:self.debrisList.img] placeholderImage:nil];
    self.nameLabel.text = self.debrisList.tag;
    NSString *tempSte = [NSString stringWithFormat:@"%ld条", (long)self.debrisList.count];
    self.countLabel.text = tempSte;
    
}




@end
